package com.jdeng.controller;

import com.jdeng.api.Goods;
import com.jdeng.api.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class GoodController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping("/goods")
    @ResponseBody
    public Goods getGoods(Integer id){
        return goodsService.getGoods(id);
    }

    @RequestMapping("/selectGoods")
    @ResponseBody
    public Goods selectGoods(Integer id, String name, String shortName){
        return goodsService.selectGoods(id, name, shortName);
    }

    @RequestMapping("/insertGoods")
    @ResponseBody
    public void insertGoods(Integer id){
         goodsService.insertGoods(id);
    }
}
